package com.hubu.web;

import com.hubu.mapper.studentUserMapper;
import com.hubu.mapper.administratorUserMapper;
import com.hubu.pojo.administratorUser;
import com.hubu.pojo.student_Information;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class Test {
    public static void main(String[] args) throws IOException {
        String resource = "mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(inputStream);

        //2.2获取SqlSession对象
        SqlSession sqlSession=sqlSessionFactory.openSession();
        administratorUserMapper administratorUserMapper=sqlSession.getMapper(com.hubu.mapper.administratorUserMapper.class);
        studentUserMapper studentUserMapper=sqlSession.getMapper(com.hubu.mapper.studentUserMapper.class);

        //删除学号为202104的学生信息
        administratorUserMapper.deleteStudentById("202104");

        sqlSession.commit();
        sqlSession.close();

    }
}
